package com.topisv.tms.service.proceduce;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;

import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
@Transactional(readOnly = true)
public class DeleteShippedBatch {
	@Autowired
	private BasicDataSource dataSource;

	@Transactional(readOnly = false)
	public boolean executeProcedures(final String proceduresName)
			throws SQLException {
		String sql = "{call deleteShippedBatch(?)}";
		Connection connection = null;
		CallableStatement callableStatement = null;
		boolean fa = false;
		try {
			connection = dataSource.getConnection();
			callableStatement = connection.prepareCall(sql);
			callableStatement.setString(1, proceduresName);
			fa = callableStatement.execute();
		} catch (Exception e) {

		} finally {
			/*if (callableStatement != null) {
				callableStatement.close();

			}
			if (connection != null) {
				connection.close();
			}*/
		}

		return fa;
	}
}
